from database import get_conn, Employee


class UserService:
    def login(self, email, password):
        s = get_conn()
        user = s.query(Employee).filter_by(name=email).first()
        if not user:
            print('no such user')
        else:
            print('login successful')
            # authrizetion token

    def register(self, name,email,phone,employee_no):
        print('register')
        s = get_conn()
        e = Employee(name=name,email=email,phone=phone,employee_no=employee_no)
        s.add(e)
        s.commit()

